from typing import Generic, TypeVar, Union, Optional

Fail = TypeVar("Fail", covariant=True)
Succ = TypeVar("Succ", covariant=True)

S = TypeVar("S")
F = TypeVar("F")

class Result(Generic[Fail, Succ]):
    def is_ok(self) -> bool: ...
    def is_err(self) -> bool: ...
    def ok(self) -> Optional[Succ]: ...
    def err(self) -> Optional[Fail]: ...
    @property
    def value(self) -> Union[Fail, Succ]: ...
    def expect(self, message: str) -> Succ: ...
    def unwrap(self) -> Succ: ...
    def unwrap_or(self, default: S) -> Union[Succ, S]: ...

def Ok(value: S) -> Result[F, S]: ...
def Err(error: F) -> Result[F, S]: ...
